package xyz.xtt.schedule.mapper.equity;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import xyz.xtt.schedule.entity.TblLuckPhonePool;

import java.util.List;

/**
 * 靓号池 Mapper 接口
 *
 * @author dale
 * @since 2024/12/31
 **/
public interface TblLuckPhonePoolMapper extends BaseMapper<TblLuckPhonePool> {
    @Select("SELECT MAX(batch_no) FROM tbl_luck_phone_pool")
    Long selectMaxBatchNo();

    @Insert({
            "<script>",
            "INSERT IGNORE INTO tbl_luck_phone_pool (",
            "id, tele_phone, province, city, create_time, delist_date, listing_date, lock_status,",
            " min_consumption, monthly_rent, network, package_details, product_name, remark, ",
            "shelf_status, telephone_grade, batch_no,form) VALUES ",
            "<foreach collection='list' item='item' separator=','>",
            "(#{item.id},#{item.telephone}, #{item.province}, #{item.city}, #{item.createTime}, ",
            "#{item.delistDate}, #{item.listingDate}, #{item.lockStatus}, ",
            "#{item.minConsumption}, #{item.monthlyRent}, #{item.network}, #{item.packageDetails}, #{item.productName}, #{item.remark}, ",
            " #{item.shelfStatus},#{item.telephoneGrade},#{item.batchNo},#{item.form})",
            "</foreach>",
            "</script>"
    })
    int insertBatchIgnore(@Param("list") List<TblLuckPhonePool> entitles);
}
